package JavaSE.StreamLearning.BufferIOStream;

import java.io.*;

/**
 * 使用BufferedInputStream/BufferedOutputStream
 * 字节缓冲流复制视频--------相对路径
 */

public class BufferTest {
    public static void main(String[] args) throws IOException {
        System.out.println(System.getProperty("user.dir"));
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("src\\JavaSE.StreamLearning.BufferIOStream\\除暴.mp4"));
        File f = new File("src\\JavaSE.StreamLearning.BufferIOStream\\a.mp4");
        System.out.println(f.getAbsolutePath());
        FileOutputStream file = new FileOutputStream(f);
        BufferedOutputStream bos = new BufferedOutputStream(file);
        int readCount;
        byte[] bytes = new byte[1024000000];
        long start = System.currentTimeMillis();
        while((readCount = bis.read(bytes)) != -1) {
            bos.write(bytes,0,readCount);
        }
        long end = System.currentTimeMillis();
        System.out.println("耗时：" + (end - start));
    }
}
